From 56888840c4bd1c6b356c04c92b637bb112243b89 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Thu, 8 Nov 2018 18:12:19 +0000 Subject: [PATCH] x86/hvm: Unify hvm_event_pending()'s API with the !CONFIG_HVM version This patch should have been part of, or a prerequiesite of, c/s 981c9a78 "x86: provide stubs, declarations and macros in hvm.h" to avoid getting the API's out of sync. Signed-off-by: Andrew Cooper Reviewed-by: Wei Liu Reviewed-by: Boris Ostrovsky Reviewed-by: Kevin Tian Acked-by: Jan Beulich --- xen/arch/x86/hvm/svm/svm.c | 5 ++--- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/include/asm-x86/hvm/hvm.h | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 07a5ed8011..396ee4a370 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1581,10 +1581,9 @@ static void svm_inject_event(const struct x86_event *event) HVMTRACE_2D(INJ_EXC, _event.vector, _event.error_code); } -static int svm_event_pending(struct vcpu *v) +static bool svm_event_pending(const struct vcpu *v) { - struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb; - return vmcb->eventinj.fields.v; + return v->arch.hvm.svm.vmcb->eventinj.fields.v; } static void svm_cpu_dead(unsigned int cpu) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index e065f8bbdb..365eeb2886 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1903,7 +1903,7 @@ static void vmx_inject_event(const struct x86_event *event) HVMTRACE_2D(INJ_EXC, _event.vector, _event.error_code); } -static int vmx_event_pending(struct vcpu *v) +static bool vmx_event_pending(const struct vcpu *v) { unsigned long intr_info; diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 2a1acd8bfa..3d3250dff0 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -158,7 +158,7 @@ struct hvm_function_table { void (*init_hypercall_page)(struct domain *d, void *hypercall_page); - int (*event_pending)(struct vcpu *v); + bool (*event_pending)(const struct vcpu *v); bool (*get_pending_event)(struct vcpu *v, struct x86_event *info); void (*invlpg)(struct vcpu *v, unsigned long linear); @@ -507,7 +507,7 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2) hvm_inject_event(&event); } -static inline int hvm_event_pending(struct vcpu *v) +static inline bool hvm_event_pending(const struct vcpu *v) { return hvm_funcs.event_pending(v); } -- 2.30.2